package com.yiyuan.weixin.weixinInservice.Iml;

import com.yiyuan.weixin.model.ReceiveXmlEntity;
import com.yiyuan.weixin.weixinInservice.format.*;

import javax.servlet.http.HttpServletResponse;

/**
 * Created by admin on 2017/3/28.
 */
public class WXResposeEvent extends AbsWXResponse {
    FormatXmlService formatXmlService;

    @Override
    public void wxRespond(HttpServletResponse resp, ReceiveXmlEntity xmlEntity) {
        String text=xmlEntity.getContent();
        switch (text)
        {

            case "A":
            case "a":
                formatXmlService=new FormatXmlNews();
                break;
            case "B":
            case "b":
                formatXmlService=new FormatXmlImage();
                break;
            case "C":
            case "c":
                formatXmlService=new FormatXmlVoice();
                break;
            case "D":
            case "d":
                formatXmlService=new FormatXmlVideo();
                break;
            case "E":
            case "e":
                formatXmlService=new FormatXmlMusic();
                break;
            default:
                formatXmlService=new FormatXmlText();
        }
        text=formatXmlService.formatXml(xmlEntity);
        responseMessage(resp,text);
    }
}
